PowerTCP Mail for .NET
Globalization Notes



The MailMessage class fully supports international standards for encoding and decoding.

RFC 822/2822 Encoding Standards

An encoded MailMessage will typically contain 7-bit ASCII characters because mail servers and the internet in general only guarantee 7-bit support. PowerTCP defaults to 7-bit encoding for compatibility purposes, but 8-bit encodings may be specified if a full 8-bit path (servers, routers, etc) is known to exist.

Header Encoding

Header fields support the encoding of 16-bit UNICODE characters, so non-english text such as "メールテスト" can be included in subject lines or email addresses. This is accomplished using encoded-word syntax, which can be used to encode any UNICODE string. The encoding specified by Header.Encoding is used to encode these UNICODE strings into 8-bit bytes and then BASE64 is used to convert that into 7-bit ASCII characters.

Header Decoding

Header decoding is usually a straight-forward matter of decoding an encoded-word string, but some clients may send emails containing out-of-spec 8-bit headers, resulting in the non-ASCII data displaying as question marks. To handle these out-of-spec emails, the value of EncodingMap["headers"] may be changed to any system encoding to use a non-ASCII decoder for header data.

Transfer Encoding

Multipart MIME supports the transfer of binary data by standardizing the encoding of parts and attachments. PowerTCP Mail for .NET supports the older UUENCODE standard as well as modern encoding standards (BASE64 and Quoted-Printable). BASE64 typically uses a fixed-length 76 ASCII character line to encode binary data. Quoted-Printable encodes some 7-bit and all 8-bit values so the encoded result is generally human-readable.

Character Encoding

UNICODE strings (16-bit characters) must be encoded (just like binary data). This is automatically handled by the component, using Textpart.Encoding to encode the text string into 7-bit ASCII characters or 8-bit bytes (depending on the encoding specified) and then transfer-encoded depending on the value of Resource.TransferEncoding.

Character Decoding

String decoding is usually a straight-forward matter of using the character encoding specified in the part's Content-Type header field, but some emails are slightly off-spec. For this reason PowerTCP Mail for .NET includes an EncodingMap that allows any specified charset to be mapped to a system encoding. This allows developers to compensate somewhat for third-party email software that uses non-standard charset strings.


PowerTCP Mail for .NET Documentation Version 4.3
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic